const express = require("express")

const router = express.Router()
const goodsHandle = require("../router_handle/goods_handle.js")
// 1. 导入验证表单数据的中间件
const expressJoi = require('@escook/express-joi')
// 2. 导入需要的验证规则对象
const { addGoods_schema } = require('../schema/user')
const multer = require("multer")
const path = require("path")



router.post("/all",goodsHandle.getGoods)
router.post('/add',goodsHandle.addGoods)
router.post("/delete",goodsHandle.delGoods)
router.post("/search",goodsHandle.findGoods)
router.post("/updateGoods",goodsHandle.updateGoods)
router.get("/brand",goodsHandle.getBrand)
router.post("/addBrand",goodsHandle.insertBrand)
router.post("/getBrandByPage",goodsHandle.getBrandByPage)
router.post("/getShop",goodsHandle.getShop)
router.post("/getShopList",goodsHandle.getShopList)
//添加商品
router.post("/uploadImg",multer({
    //设置文件存储路径
    dest: "images",
}).array("file", 1),goodsHandle.uploadImg)

module.exports = router